import Http from 'zjy-ui/lib/utils/http'
import store from '@/store'
import { throttle } from 'lodash'
const loginOut = throttle(function () {
	store.dispatch('user/loginOut')
	throw new Error('登录过期，请重新登录')
}, 2000) // 防止重复弹401
const _http = new Http(process.env.BASE_URL)
// console.log('_http', _http.baseURL)
// console.log('_http', _http)

_http.addResponseHandle(401, loginOut)
_http.addResponseHandle(403, loginOut)

export default _http
